package com.winchain.provider;

import com.shell.bee.base.utils.StringUtil;
import com.shell.framework.utils.SysDateUtil;
import com.winchain.chainbill.bill.base.service.CbDctDatsService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CbDctDatsProvider {
	protected final Log logger = LogFactory.getLog(getClass());
	@Autowired
	private CbDctDatsService cbDctDatsService;

	@RequestMapping({ "/dctDats/calDayTotalAmt" })
	public void calDayTotalAmt(@RequestParam("date") final String date) {
		new Thread(new Runnable() {
			public void run() {
				CbDctDatsProvider.this.logger.info("--------DctDatsBatchJobExecutor excute start--------");
				String workDate = date;
				if (StringUtil.emptyAndNull(workDate)) {
					workDate = SysDateUtil.getSystemDate();
				}
				CbDctDatsProvider.this.logger.info("--------excute date:" + workDate);
				CbDctDatsProvider.this.cbDctDatsService.calDayTotalAmt(workDate);
				CbDctDatsProvider.this.logger.info("--------DctDatsBatchJobExecutor excute end--------");
			}
		})

				.start();
	}
}
